home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / chap03 / howto09 / ufmgr18.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1996-03-06  |  57.0 KB  |  1,640 lines

  1. unit Ufmgr18;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, ShellAPI, FileCtrl,
  8.    DRWSUtl1, DRWSUtl3;
  9.  
  10. type
  11.   TCCFileMgrForm = class(TForm)
  12.     Panel1: TPanel;
  13.     Panel2: TPanel;
  14.     BitBtn1: TBitBtn;
  15.     Panel3: TPanel;
  16.     Label1: TLabel;
  17.     BitBtn2: TBitBtn;
  18.     BitBtn3: TBitBtn;
  19.     BitBtn4: TBitBtn;
  20.     BitBtn5: TBitBtn;
  21.     BitBtn6: TBitBtn;
  22.     BitBtn7: TBitBtn;
  23.     OpenDialog1: TOpenDialog;
  24.     BitBtn8: TBitBtn;
  25.     BitBtn9: TBitBtn;
  26.     OpenDialog2: TOpenDialog;
  27.     BitBtn10: TBitBtn;
  28.     Panel4: TPanel;
  29.     Panel5: TPanel;
  30.     Panel6: TPanel;
  31.     Panel7: TPanel;
  32.     Label2: TLabel;
  33.     Label3: TLabel;
  34.     Label4: TLabel;
  35.     procedure FormResize(Sender: TObject);
  36.     procedure FormCreate(Sender: TObject);
  37.     procedure BitBtn7Click(Sender: TObject);
  38.     procedure BitBtn1Click(Sender: TObject);
  39.     procedure BitBtn2Click(Sender: TObject);
  40.     procedure BitBtn3Click(Sender: TObject);
  41.     procedure BitBtn4Click(Sender: TObject);
  42.     procedure BitBtn5Click(Sender: TObject);
  43.     procedure FormPaint(Sender: TObject);
  44.     procedure BitBtn8Click(Sender: TObject);
  45.     procedure BitBtn9Click(Sender: TObject);
  46.     procedure BitBtn6Click(Sender: TObject);
  47.     procedure BitBtn1DragDrop(Sender, Source: TObject; X, Y: Integer);
  48.     procedure BitBtn1DragOver(Sender, Source: TObject; X, Y: Integer;
  49.       State: TDragState; var Accept: Boolean);
  50.     procedure BitBtn2DragDrop(Sender, Source: TObject; X, Y: Integer);
  51.     procedure BitBtn3DragDrop(Sender, Source: TObject; X, Y: Integer);
  52.     procedure BitBtn4DragDrop(Sender, Source: TObject; X, Y: Integer);
  53.     procedure BitBtn10Click(Sender: TObject);
  54.     procedure FormDestroy(Sender: TObject);
  55.     procedure FormKeyDown(Sender: TObject; var Key: Word;
  56.       Shift: TShiftState);
  57.     procedure BitBtn9KeyDown(Sender: TObject; var Key: Word;
  58.       Shift: TShiftState);
  59.     procedure Label2Click(Sender: TObject);
  60.     procedure Label3Click(Sender: TObject);
  61.     procedure Label4Click(Sender: TObject);
  62.     procedure Panel2MouseMove(Sender: TObject; Shift: TShiftState; X,
  63.       Y: Integer);
  64.     procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
  65.       Y: Integer);
  66.     procedure Panel4MouseMove(Sender: TObject; Shift: TShiftState; X,
  67.       Y: Integer);
  68.     procedure Panel3MouseMove(Sender: TObject; Shift: TShiftState; X,
  69.       Y: Integer);
  70.     procedure BitBtn1MouseMove(Sender: TObject; Shift: TShiftState; X,
  71.       Y: Integer);
  72.     procedure BitBtn2MouseMove(Sender: TObject; Shift: TShiftState; X,
  73.       Y: Integer);
  74.     procedure BitBtn3MouseMove(Sender: TObject; Shift: TShiftState; X,
  75.       Y: Integer);
  76.     procedure BitBtn4MouseMove(Sender: TObject; Shift: TShiftState; X,
  77.       Y: Integer);
  78.     procedure BitBtn5MouseMove(Sender: TObject; Shift: TShiftState; X,
  79.       Y: Integer);
  80.     procedure BitBtn8MouseMove(Sender: TObject; Shift: TShiftState; X,
  81.       Y: Integer);
  82.     procedure BitBtn9MouseMove(Sender: TObject; Shift: TShiftState; X,
  83.       Y: Integer);
  84.     procedure BitBtn6MouseMove(Sender: TObject; Shift: TShiftState; X,
  85.       Y: Integer);
  86.     procedure BitBtn7MouseMove(Sender: TObject; Shift: TShiftState; X,
  87.       Y: Integer);
  88.     procedure BitBtn10MouseMove(Sender: TObject; Shift: TShiftState; X,
  89.       Y: Integer);
  90.     procedure Panel5MouseMove(Sender: TObject; Shift: TShiftState; X,
  91.       Y: Integer);
  92.     procedure Panel6MouseMove(Sender: TObject; Shift: TShiftState; X,
  93.       Y: Integer);
  94.     procedure Panel7MouseMove(Sender: TObject; Shift: TShiftState; X,
  95.       Y: Integer);
  96.     procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton;
  97.       Shift: TShiftState; X, Y: Integer);
  98.     procedure BitBtn1MouseUp(Sender: TObject; Button: TMouseButton;
  99.       Shift: TShiftState; X, Y: Integer);
  100.     procedure BitBtn2MouseUp(Sender: TObject; Button: TMouseButton;
  101.       Shift: TShiftState; X, Y: Integer);
  102.     procedure BitBtn3MouseUp(Sender: TObject; Button: TMouseButton;
  103.       Shift: TShiftState; X, Y: Integer);
  104.     procedure BitBtn4MouseUp(Sender: TObject; Button: TMouseButton;
  105.       Shift: TShiftState; X, Y: Integer);
  106.   private
  107.     { Private declarations }
  108.   public
  109.     { Public declarations }
  110.     DirectoryListBox1 : TDirectoryListBox;
  111.     FileListBox1 : TIconFileListBox;
  112.     ScrollBox1 : TFileIconPanelScrollbox;
  113.   end;
  114. var
  115.   SavedForm ,
  116.   CCFileMgrForm      : TCCFileMgrForm;
  117.   CurrentView        : Integer;  { This holds the current view setting      }
  118.   TheClockList       : TList;
  119.   Clock1,
  120.   Clock2,
  121.   Clock3             : TIcon;
  122.  
  123. implementation
  124.  
  125. {$R *.DFM}
  126.  
  127. uses DDDFUnit,  { Include custom directory selection form }
  128.      CfmpfUn;   { Include custom options dialog           }
  129.  
  130. { Set up the resize to replace the icon buttons }
  131. procedure TCCFileMgrForm.FormResize(Sender: TObject);
  132. begin
  133.   { Send in the panel and global buttons list }
  134.   SpacePanelButtons( Panel2 );
  135. end;
  136.  
  137. { Delphi wrote this; use it to set everything up }
  138. procedure TCCFileMgrForm.FormCreate(Sender: TObject);
  139. var TheIconPanel : TFileIconPanel;
  140.     CurrentPath : String;
  141. begin
  142.   { Create the directory list box }
  143.   SavedForm := Self;
  144.   DirectoryListBox1 := TDirectoryListBox.Create( Panel1 );
  145.   DirectoryListBox1.Parent := Panel1;
  146.   DirectoryListBox1.Visible := true;
  147.   DirectoryListbox1.Top := 17;
  148.   DirectoryListbox1.Left := 0;
  149.   DirectoryListbox1.Height := Panel1.Height - 32;
  150.   DirectoryListbox1.Width := 0;
  151.   { Create the file list box }
  152.   FileListBox1 := TIconFileListBox.Create( Panel1 );
  153.   FileListBox1.Parent := Panel1;
  154.   FileListbox1.Top := 17;
  155.   FileListbox1.Left := 146;
  156.   FileListbox1.Height := Panel1.Height - 32;
  157.   FileListbox1.Width := 0;
  158.   FileListBox1.Visible := true;
  159.   FileListBox1.ShowGlyphs := true;
  160.   FileListBox1.MultiSelect := true;
  161.   FileListBox1.DragMode := dmAutomatic;
  162.   { Set intercomponent interactions }
  163.   DirectoryListBox1.FileList := FileListbox1;
  164.   DirectoryListBox1.DirLabel := Label1;
  165.   { Create the scrollbox }
  166.   ScrollBox1 := TFileIconPanelScrollBox.Create( Panel1 );
  167.   ScrollBox1.Parent := Panel1;
  168.   ScrollBox1.align := alClient;
  169.   ScrollBox1.Left := 0;
  170.   ScrollBox1.Top := 0;
  171.   ScrollBox1.Width := Panel1.Width - 32;
  172.   ScrollBox1.Height := Panel1.Height - 32;
  173.   ScrollBox1.IconsNeedRefreshing := false;
  174.   ScrollBox1.TheStoredHandle := Self.Handle;
  175.   ScrollBox1.TheParentForm := Self;
  176.   { Get the current directory with 0 parameter }
  177.   GetDir( 0 , CurrentPath );
  178.   { Set the display caption }
  179.   Label1.Caption := CurrentPath;
  180.   { Add a trailing \ if not root }
  181.   CurrentPath := ScrollBox1.TheFWB.ForceTrailingBackSlash( CurrentPath );
  182.   { Get the icons display using scrollbox1 }
  183.   ScrollBox1.GetIconsForEntireDirectory( CurrentPath );
  184.   { Set the Icon View as default }
  185.   CurrentView := 1;
  186.   { Start the FIP IOManager }
  187.   if not assigned( TheIOManager ) then
  188.   begin
  189.     TheIOManager := TIOManager.Create( Self );
  190.     TheIOManager.Parent := Self;
  191.     TheIOManager.InitLocks;
  192.   end;
  193.   if not Assigned( TheMouseManager ) then
  194.   begin
  195.     TheMouseManager := TMouseManager.Create( Self );
  196.     TheMouseManager.InitializeNormal;
  197.   end;
  198.   { Load the special cursor to toggle the LOCK keys }
  199.   Screen.Cursors[ CR_KEYSET ] := LoadCursor( hInstance , 'KEYSET' );
  200.   Screen.Cursors[ CR_NULL ] := LoadCursor( hInstance , 'BLANKCUR' );
  201.   Panel5.Cursor := CR_KEYSET;
  202.   Panel6.Cursor := CR_KEYSET;
  203.   Panel7.Cursor := CR_KEYSET;
  204.   Label2.Visible := TheIOManager.IsCapsLockDown;
  205.   Label3.Visible := TheIOManager.IsNumLockDown;
  206.   Label4.Visible := TheIOManager.IsScrollLockDown;
  207.   if not Assigned( TheClockList ) then
  208.   begin
  209.     TheClockList := TList.Create;
  210.     Clock1 := TIcon.Create;
  211.     Clock2 := TIcon.Create;
  212.     Clock3 := TIcon.Create;
  213.     Clock1.Handle := LoadIcon( hInstance , 'CLOCK_LEFT' );
  214.     Clock2.handle := LoadIcon( hInstance, 'CLOCK_MIDDLE' );
  215.     Clock3.Handle := LoadIcon( hInstance , 'CLOCK_RIGHT' );
  216.     TheClockList.Add( Clock1 );
  217.     TheClockList.Add( Clock2 );
  218.     TheClockList.Add( Clock3 );
  219.   end;
  220. end;
  221.  
  222. { Delphi wrote this; use it to close the application }
  223. procedure TCCFileMgrForm.BitBtn7Click(Sender: TObject);
  224. begin
  225.   Close;
  226. end;
  227.  
  228. { Delphi wrote this use it to perform a copy on all selected files }
  229. procedure TCCFileMgrForm.BitBtn1Click(Sender: TObject);
  230. var ThePosition  : Integer;       { Loop counter   }
  231.     CurrentName ,                 { Holds work name}
  232.     TheOldString : String;        { Holds Dir      }
  233.     finished     : Boolean;       { Loop control   }
  234.     WorkingDir   : String;        { Holds mod wd   }
  235.     TargetDir    : String;        { target of op   }
  236.     TheResult    : Integer;       { Modal res hold }
  237. begin
  238.   { Get current directory and save it for later }
  239.   GetDir( 0 , TheOldString );
  240.   { Check for need to add trailing \ }
  241.   WorkingDir := TheOldString;
  242.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
  243.   { Display the Windows-based directory input form }
  244.   TheResult := DestDDForm.ShowModal;
  245.   { If not cancelled do the copy }
  246.   if TheResult = mrOK then
  247.   begin
  248.     { Get the target directory with \ OK }
  249.     TargetDir := DestDDForm.GetTargetDirectory;
  250.     { Show the hourglass to indicate waiting }
  251.     Screen.Cursor := crHourGlass;
  252.     { Setup to get all selections }
  253.     ThePosition := 1;
  254.     finished := false;
  255.     while not finished do
  256.     begin
  257.       { Call generic file getting routine based on current view}
  258.       case CurrentView of
  259.         1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  260.              ThePosition );
  261.         2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  262.              ThePosition );
  263.       end;
  264.       { If returns blank string out of selections so exit }
  265.       if CurrentName = '' then finished := true else
  266.       begin
  267.         { If a directory signal error }
  268.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  269.         begin
  270.           if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  271.            +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  272.           begin
  273.             ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  274.              TargetDir );
  275.           end;
  276.         end
  277.         else
  278.         begin
  279.           Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  280.         end;
  281.       end;
  282.     end;
  283.     { Reset to normal cursor }
  284.     Screen.Cursor := crDefault;
  285.   end;
  286.   { Reset to the original directory }
  287.   ChDir( TheOldString );
  288. end;
  289.  
  290. { Delphi wrote this, use it to move files which are selected }
  291. procedure TCCFileMgrForm.BitBtn2Click(Sender: TObject);
  292. var ThePosition  : Integer;       { Loop counter   }
  293.     CurrentName ,                 { Holds work name}
  294.     TheOldString : String;        { Holds Dir      }
  295.     finished     : Boolean;       { Loop control   }
  296.     WorkingDir   : String;        { Holds mod wd   }
  297.     TargetDir    : String;        { target of op   }
  298.     TheResult    : Integer;       { Modal res hold }
  299. begin
  300.   { Get current directory and save it for later }
  301.   GetDir( 0 , TheOldString );
  302.   { Check for need to add trailing \ }
  303.   WorkingDir := TheOldString;
  304.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  305.   { Display the Windows-based directory input form }
  306.   TheResult := DestDDForm.ShowModal;
  307.   { If not cancelled do the copy }
  308.   if TheResult = mrOK then
  309.   begin
  310.     { Get the target directory with \ OK }
  311.     TargetDir := DestDDForm.GetTargetDirectory;
  312.     { Show the hourglass to indicate waiting }
  313.     Screen.Cursor := crHourGlass;
  314.     { Set up to get all current selections }
  315.     ThePosition := 1;
  316.     finished := false;
  317.     while not finished do
  318.     begin
  319.       { Call generic file getting routine based on current view}
  320.       case CurrentView of
  321.         1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  322.              ThePosition );
  323.         2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  324.              ThePosition );
  325.       end;
  326.       { If returns blank string then out of selections }
  327.       if CurrentName = '' then finished := true else
  328.       begin
  329.         { If a directory signal error }
  330.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  331.         begin
  332.           if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
  333.            '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
  334.             ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  335.              TargetDir );
  336.         end
  337.         else
  338.         begin
  339.           Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  340.         end;
  341.       end;
  342.       { Reset to normal cursor }
  343.       Screen.Cursor := crDefault;
  344.     end;
  345.   end;
  346.   { Reset to the original directory }
  347.   ChDir( TheOldString );
  348.   if CurrentView = 1 then { Reset icon display if in view }
  349.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  350. end;
  351.  
  352. { Delphi wrote this, use it to delete files which are selected }
  353. procedure TCCFileMgrForm.BitBtn3Click(Sender: TObject);
  354. var ThePosition  : Integer;       { Loop counter   }
  355.     CurrentName ,                 { Holds work name}
  356.     TheOldString : String;        { Holds Dir      }
  357.     finished     : Boolean;       { Loop control   }
  358.     WorkingDir   : String;        { Holds mod wd   }
  359. begin
  360.   { Get current directory and save it for later }
  361.   GetDir( 0 , TheOldString );
  362.   { Check for need to add trailing \ }
  363.   WorkingDir := TheOldString;
  364.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  365.   { Set up to do loop for selected files }
  366.   ThePosition := 1;
  367.   finished := false;
  368.   while not finished do
  369.   begin
  370.     { Call generic file getting routine based on current view}
  371.     case CurrentView of
  372.       1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  373.            ThePosition );
  374.       2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  375.            ThePosition );
  376.     end;
  377.     { if returns blank string out of selections }
  378.     if CurrentName = '' then finished := true else
  379.     begin
  380.       { If its a directory signal error }
  381.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  382.       begin
  383.         if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation,
  384.          mbYesNoCancel , 0 ) = mrYes then
  385.         begin
  386.           ScrollBox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  387.           Scrollbox1.TheFWB.RemoveDirectory( Currentname );
  388.         end;
  389.       end
  390.       else
  391.       begin
  392.         { Otherwise get confirmation message and if OKed delete file }
  393.         if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  394.          mbYesNoCancel , 0 ) = mrYes then
  395.         begin
  396.           ScrollBox1.TheFWB.DeleteTheFile( Currentname );
  397.         end;
  398.       end;
  399.     end;
  400.   end;
  401.   if CurrentView = 1 then { Reset icon display if in view }
  402.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  403. end;
  404.  
  405. { Delphi wrote this; use it to rename selected files }
  406. procedure TCCFileMgrForm.BitBtn4Click(Sender: TObject);
  407. var ThePosition  : Integer;       { Loop counter   }
  408.     CurrentName ,                 { Holds work name}
  409.     TheOldString : String;        { Holds Dir      }
  410.     finished     : Boolean;       { Loop control   }
  411.     WorkingDir   : String;        { Holds mod wd   }
  412. begin
  413.   { Get current directory for later }
  414.   GetDir( 0 , TheOldString );
  415.   { Check for need to add trailing \ }
  416.   WorkingDir := TheOldString;
  417.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  418.   { Set up to do loop for selected files }
  419.   ThePosition := 1;
  420.   finished := false;
  421.   while not finished do
  422.   begin
  423.     { Call generic file getting routine based on current view}
  424.     case CurrentView of
  425.       1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  426.            ThePosition );
  427.       2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  428.            ThePosition );
  429.     end;
  430.     { If returns blank string then out of selections }
  431.     if CurrentName = '' then finished := true else
  432.     begin
  433.       { Otherwise set up the opendialog with filename and caption }
  434.       OpenDialog1.Filename := ExtractFilename( CurrentName );
  435.       { Use this to prevent error from changing directories }
  436.       OpenDialog1.Options := [ofNoChangeDir];
  437.       OpenDialog1.Title := 'Rename File';
  438.       { If not cancelled then do rename or signal error }
  439.       if OpenDialog1.Execute then
  440.       begin
  441.         ScrollBox1.TheFWB.RenameTheFile( CurrentName , OpenDialog1.Filename );
  442.       end;
  443.     end;
  444.   end;
  445.   if CurrentView = 1 then { Reset icon display if in view }
  446.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  447. end;
  448.  
  449. { Delphi wrote this; use it to make a new directory under current one }
  450. procedure TCCFileMgrForm.BitBtn5Click(Sender: TObject);
  451. begin
  452.   { Set up the dialog to get the new directory name }
  453.   OpenDialog2.FileName := '*.*';
  454.   OpenDialog2.Title := 'Enter Directory Name';
  455.   if OpenDialog1.Execute then
  456.   begin
  457.     { If not cancelled make new directory }
  458.     Scrollbox1.TheFWB.CreateNewDirectory( OpenDialog1.Filename );
  459.   end;
  460.   if CurrentView = 1 then { Reset icon display if in view }
  461.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  462. end;
  463.  
  464. { Delphi wrote this; use it to handle refreshing the scrollbox }
  465. procedure TCCFileMgrForm.FormPaint(Sender: TObject);
  466. var CurrentDirectory : String; { Get current dir }
  467. begin
  468.   { If updated, do refresh }
  469.   if ScrollBox1.IconsNeedRefreshing then
  470.   begin
  471.     Scrollbox1.ClearTheFIPs;
  472.     ScrollBox1.IconsNeedRefreshing := false;
  473.     GetDir( 0 , CurrentDirectory );
  474.     { Force trailing backslash }
  475.     CurrentDirectory := ScrollBox1.TheFWB.ForceTrailingBackSlash(
  476.      CurrentDirectory );
  477.     { Set the label to the new directory }
  478.     Label1.Caption := UpperCase( CurrentDirectory );
  479.     { Do the update }
  480.     ScrollBox1.GetIconsForEntireDirectory( CurrentDirectory );
  481.   end;
  482. end;
  483.  
  484. { Delphi wrote this; use it to reset the current view Icons/List }
  485. procedure TCCFileMgrForm.BitBtn8Click(Sender: TObject);
  486. var TheOldString : String; { Use to get current directory }
  487. begin
  488.   { Reset currentview }
  489.   if CurrentView = 1 then CurrentView := 2 else
  490.    CurrentView := 1;
  491.   { either show the windows boxes or the scrollbox }
  492.   case CurrentView of
  493.     1 : begin
  494.           { Make the listboxes invisible by changing align and width }
  495.           FileListBox1.Visible := false;
  496.           FileListBox1.Align := alNone;
  497.           FileListBox1.Width := 0;
  498.           DirectoryListBox1.Visible := false;
  499.           DirectoryListBox1.align := alNone;
  500.           DirectoryListBox1.Width := 0;
  501.           { Keep them from getting mouse clicks }
  502.           FileListBox1.Enabled := false;
  503.           DirectoryListBox1.Enabled := false;
  504.           { Have the scrollbox get mouse and be seen  by resetting align/wid}
  505.           Scrollbox1.align := alClient;
  506.           Scrollbox1.width := Panel1.Width - 32;
  507.           ScrollBox1.Enabled := true;
  508.           { Tell the scrollbox to repaint itself just in case }
  509.           ScrollBox1.Update;
  510.         end;
  511.     2 : begin
  512.           { Make the listboxes visible by resetting align and width}
  513.           FileListBox1.Visible := true;
  514.           DirectoryListBox1.Visible := true;
  515.           DirectoryListBox1.width := 145;
  516.           DirectoryListBox1.align := alLeft;
  517.           FileListBox1.align := alClient;
  518.           FileListBox1.Width := Panel1.Width - 32 - DirectoryListBox1.Width;
  519.           { Have them getting mouse clicks }
  520.           FileListBox1.Enabled := true;
  521.           DirectoryListBox1.Enabled := true;
  522.           { Have the scrollbox not get mouse and not be seen via align/width}
  523.           ScrollBox1.Enabled := false;
  524.           ScrollBox1.Visible := false;
  525.           ScrollBox1.align := alNone;
  526.           ScrollBox1.Width := 0;
  527.         end;
  528.   end;
  529.   Invalidate;
  530. end;
  531.  
  532. { Delphi wrote this; use it to do a file search display }
  533. procedure TCCFileMgrForm.BitBtn9Click(Sender: TObject);
  534. var CurrentDirectory : String; { Holds current directory }
  535. begin
  536.   { Set up and run the search dialog }
  537.   OpenDialog2.FileName := '*.*';
  538.   { if not cancelled do the search }
  539.   if OpenDialog2.Execute then
  540.   begin
  541.     { Get current directory }
  542.     GetDir( 0 , CurrentDirectory );
  543.     { Force trailing backslash }
  544.     CurrentDirectory :=
  545.      ScrollBox1.TheFWB.ForceTrailingBackSlash( CurrentDirectory );
  546.     { display recursive search results }
  547.     GlobalAbortFlag := false;
  548.     Scrollbox1.DisplayRecursiveSearchResults(
  549.      CurrentDirectory + ExtractFileName( OpenDialog2.Filename ));
  550.     Label1.Caption := 'Search Results for ' + CurrentDirectory +
  551.      ExtractFileName( OpenDialog2.FileName );
  552.   end;
  553. end;
  554.  
  555. { Delphi wrote this; use it to set a file's properties }
  556. procedure TCCFileMgrForm.BitBtn6Click(Sender: TObject);
  557. var ThePosition  : Integer;       { Loop counter   }
  558.     CurrentName ,                 { Holds work name}
  559.     TheOldString : String;        { Holds Dir      }
  560.     finished     : Boolean;       { Loop control   }
  561.     WorkingDir   : String;        { Holds mod wd   }
  562. begin
  563.   { Get current directory for later }
  564.   GetDir( 0 , TheOldString );
  565.   ThePosition := 1;
  566.   { Check for need to add trailing \ }
  567.   Workingdir := TheOldString;
  568.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  569.   { Call generic file getting routine based on current view}
  570.   case CurrentView of
  571.     1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  572.          ThePosition );
  573.     2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  574.          ThePosition );
  575.   end;
  576.   { If nothing selected then abort (gets ..!) }
  577.   if CurrentName = '' then
  578.   begin
  579.     MessageDlg( 'No File Selected!' , mtError , [mbOK] , 0 );
  580.     exit;
  581.   end
  582.   else
  583.   begin
  584.     { Otherwise set up the properties form and show it }
  585.     CCFMPropsForm.WorkingFileName := CurrentName;
  586.     CCFMPropsForm.ThePosition := ThePosition;
  587.     CCFMPropsForm.BitBtn4.Enabled := true;
  588.     CCFMPropsForm.Initialize;
  589.     CCFMPropsForm.ShowModal;
  590.   end;
  591.   if CurrentView = 1 then { Reset icon display if in view }
  592.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  593. end;
  594.  
  595. { Delphi wrote this; use it to drag and drop files for copying }
  596. procedure TCCFileMgrForm.BitBtn1DragDrop(Sender, Source: TObject; X,
  597.   Y: Integer);
  598. var CurrentName ,                 { Holds work name}
  599.     WorkingDir ,
  600.     TheOldString : String;        { Holds Dir      }
  601.     TargetDir    : String;        { target of op   }
  602.     TheResult    : Integer;       { Modal res hold }
  603.     Counter_1    : Integer;
  604. begin
  605.   { Make sure source is indeed a FileIconPanel }
  606.   if Source is TIconFileListbox then
  607.   begin
  608.     with Source as TIconFileListBox do
  609.     begin
  610.      { Get current directory and save it for later }
  611.      GetDir( 0 , TheOldString );
  612.      WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( TheOldString );
  613.      { Display the Windows-based directory input form }
  614.      TheResult := DestDDForm.ShowModal;
  615.      { If not cancelled do the copy }
  616.      if TheResult = mrOK then
  617.      begin
  618.        for Counter_1 := 1 to Items.Count do
  619.        begin
  620.          if Selected[ Counter_1 - 1 ] then
  621.          begin
  622.             CurrentName := WorkingDIr + Items[ Counter_1 - 1 ];
  623.             { Get the target directory with \ OK }
  624.             TargetDir := DestDDForm.GetTargetDirectory;
  625.             { If a directory signal and do recursive operation }
  626.             if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  627.             begin
  628.               if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  629.                +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  630.               begin
  631.                 ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  632.                  TargetDir );
  633.               end;
  634.             end
  635.             else
  636.             begin
  637.               { Do the copy }
  638.               Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  639.             end;
  640.             { Reset to the original directory }
  641.             ChDir( TheOldString );
  642.           end;
  643.         end;
  644.       end;
  645.     end;
  646.     FileListBox1.Update;
  647.     exit;
  648.   end;
  649.   if TheIOManager.WasSHIFTPressed then
  650.   begin
  651.     BitBtn1Click( Source );
  652.     exit;
  653.   end;
  654.   with Source as TFileIconPanel do
  655.   begin
  656.     { Get current directory and save it for later }
  657.     GetDir( 0 , TheOldString );
  658.     { Display the Windows-based directory input form }
  659.     TheResult := DestDDForm.ShowModal;
  660.     { If not cancelled do the copy }
  661.     if TheResult = mrOK then
  662.     begin
  663.       CurrentName := FTheName;
  664.       { Get the target directory with \ OK }
  665.       TargetDir := DestDDForm.GetTargetDirectory;
  666.       { If a directory signal and do recursive operation }
  667.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  668.       begin
  669.         if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  670.          +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  671.         begin
  672.           ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  673.            TargetDir );
  674.         end;
  675.       end
  676.       else
  677.       begin
  678.         { Do the copy }
  679.         Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  680.       end;
  681.       { Reset to the original directory }
  682.       ChDir( TheOldString );
  683.     end;
  684.   end;
  685. end;
  686.  
  687. { Delphi wrote this; use it to generically OK DnD from FIPs }
  688. procedure TCCFileMgrForm.BitBtn1DragOver(Sender, Source: TObject; X,
  689.   Y: Integer; State: TDragState; var Accept: Boolean);
  690. begin
  691.   { Only accept from FileIconPanel components }
  692.   if ( Source is TFileIconPanel ) or
  693.      ( Source is TIconFileListBox ) then Accept := true else Accept := false;
  694. end;
  695.  
  696. { Delphi wrote this; use it to accept Drag and Drop moving }
  697. procedure TCCFileMgrForm.BitBtn2DragDrop(Sender, Source: TObject; X,
  698.   Y: Integer);
  699. var CurrentName ,                 { Holds work name}
  700.     WorkingDir ,
  701.     TheOldString : String;        { Holds Dir      }
  702.     TargetDir    : String;        { target of op   }
  703.     TheResult       : Integer;    { Modal res hold }
  704.     Counter_1   : Integer;
  705. begin
  706.   { Make sure source is indeed a FileIconPanel }
  707.   if Source is TIconFileListbox then
  708.   begin
  709.     with Source as TIconFileListBox do
  710.     begin
  711.       { Get current directory and save it for later }
  712.       GetDir( 0 , TheOldString );
  713.       WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( TheOldString );
  714.       { Display the Windows-based directory input form }
  715.       TheResult := DestDDForm.ShowModal;
  716.       for Counter_1 := 1 to Items.Count do
  717.       begin
  718.         if Selected[ Counter_1 - 1 ] then
  719.         begin
  720.           { If not cancelled do the copy }
  721.           if TheResult = mrOK then
  722.           begin
  723.             CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
  724.             { Get the target directory with \ OK }
  725.             TargetDir := DestDDForm.GetTargetDirectory;
  726.             { If a directory signal and do recursive operation }
  727.             if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  728.             begin
  729.               if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir
  730.                +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  731.               begin
  732.                 ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  733.                  TargetDir );
  734.               end;
  735.             end
  736.             else
  737.             begin
  738.               { Do the copy }
  739.               Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  740.             end;
  741.             { Reset to the original directory }
  742.             ChDir( TheOldString );
  743.           end;
  744.         end;
  745.       end;
  746.     end;
  747.     FileListBox1.Update;
  748.     exit;
  749.   end;
  750.   if TheIOManager.WasSHIFTPressed then
  751.   begin
  752.     BitBtn2Click( Source );
  753.     exit;
  754.   end;
  755.   with Source as TFileIconPanel do
  756.   begin
  757.     { Get current directory and save it for later }
  758.     GetDir( 0 , TheOldString );
  759.     { Display the Windows-based directory input form }
  760.     TheResult := DestDDForm.ShowModal;
  761.     { If not cancelled do the copy }
  762.     if TheResult = mrOK then
  763.     begin
  764.       { Get the target directory with \ OK }
  765.       TargetDir := DestDDForm.GetTargetDirectory;
  766.       { If Copyfile returns false an error occurred }
  767.       CurrentName := FTheName;
  768.       { If a directory signal and do recursion }
  769.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  770.       begin
  771.         if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
  772.          '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
  773.           ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  774.            TargetDir );
  775.       end
  776.       else
  777.       begin  { Do the move }
  778.         Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  779.         ChDir( TheOldString );
  780.       end;
  781.       { Refresh display }
  782.       ScrollBox1.Update;
  783.     end;
  784.   end;
  785. end;
  786.  
  787. { Delphi wrote this; use it to do drag and drop deletes }
  788. procedure TCCFileMgrForm.BitBtn3DragDrop(Sender, Source: TObject; X,
  789.   Y: Integer);
  790. var WorkingDir ,
  791.     CurrentName : String;  { Holds work name}
  792.     Counter_1   : Integer;
  793. begin
  794.   { Make sure source is indeed a FileIconPanel }
  795.   if Source is TIconFileListbox then
  796.   begin
  797.     with Source as TIconFileListBox do
  798.     begin
  799.       GetDir( 0 , WorkingDir );
  800.       WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
  801.       for Counter_1 := 1 to Items.Count do
  802.       begin
  803.         if Selected[ Counter_1 - 1 ] then
  804.         begin
  805.           CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
  806.           { If a directory signal and do recursive operation }
  807.           if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  808.           begin
  809.             if MessageDlg( 'Delete Directory ' + CurrentName +'?',
  810.              mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  811.             begin
  812.               ScrollBox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  813.               Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
  814.             end;
  815.           end
  816.           else
  817.           begin
  818.             if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  819.              mbYesNoCancel , 0 ) = mrYes then
  820.             begin
  821.               Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
  822.             end;
  823.           end;
  824.         end;
  825.       end;
  826.     end;
  827.     FileListBox1.Update;
  828.     exit;
  829.   end;
  830.   if TheIOManager.WasSHIFTPressed then
  831.   begin
  832.     BitBtn3Click( Source );
  833.     exit;
  834.   end;
  835.   with Source as TFileIconPanel do
  836.   begin
  837.     CurrentName := FTheName;
  838.     { If its a directory signal and do recursive delete }
  839.     if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  840.     begin
  841.       if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation ,
  842.        mbYesNoCancel , 0 ) = mrYes then
  843.       begin
  844.         Scrollbox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  845.         Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
  846.       end;
  847.     end
  848.     else
  849.     begin
  850.       { Otherwise get confirmation message and if OKed delete file }
  851.       if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  852.        mbYesNoCancel , 0 ) = mrYes then
  853.       begin
  854.         Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
  855.       end;
  856.     end;
  857.     { Refresh Display }
  858.     Scrollbox1.Update;
  859.   end;
  860. end;
  861.  
  862. { Delphi wrote this; use it to do drag and drop renames }
  863. procedure TCCFileMgrForm.BitBtn4DragDrop(Sender, Source: TObject; X,
  864.   Y: Integer);
  865. var WorkingDir ,
  866.     CurrentName : String;  { Holds work name}
  867.     Counter_1   : Integer;
  868. begin
  869.   { Make sure source is indeed a FileIconPanel }
  870.   if Source is TIconFileListbox then
  871.   begin
  872.     with Source as TIconFileListBox do
  873.     begin
  874.       GetDir( 0 , WorkingDir );
  875.       WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
  876.       for Counter_1 := 1 to Items.Count do
  877.       begin
  878.         if Selected[ Counter_1 - 1 ] then
  879.         begin
  880.           CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
  881.           { Otherwise set up the opendialog with filename and caption }
  882.           OpenDialog2.Filename := ExtractFilename( CurrentName );
  883.           { Use this to prevent error from changing directories }
  884.           OpenDialog2.Options := [ofNoChangeDir];
  885.           OpenDialog2.Title := 'Rename File';
  886.           { If not cancelled then do rename or signal error }
  887.           if OpenDialog2.Execute then
  888.           begin
  889.             Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog2.Filename );
  890.           end;
  891.         end;
  892.       end;
  893.     end;
  894.     FileListBox1.Update;
  895.     exit;
  896.   end;
  897.   if TheIOManager.WasSHIFTPressed then
  898.   begin
  899.     BitBtn4Click( Source );
  900.     exit;
  901.   end;
  902.   with Source as TFileIconPanel do
  903.   begin
  904.     CurrentName := FTheName;
  905.     { If a directory signal error }
  906.     { Otherwise set up the opendialog with filename and caption }
  907.     OpenDialog2.Filename := ExtractFilename( CurrentName );
  908.     { Use this to prevent error from changing directories }
  909.     OpenDialog2.Options := [ofNoChangeDir];
  910.     OpenDialog2.Title := 'Rename File';
  911.     { If not cancelled then do rename or signal error }
  912.     if OpenDialog2.Execute then
  913.     begin
  914.       Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog1.Filename );
  915.     end;
  916.     { Refresh the display }
  917.     ScrollBox1.Update;
  918.   end;
  919. end;
  920.  
  921. { Delphi wrote this; use it to create a copy form }
  922. procedure TCCFileMgrForm.BitBtn10Click(Sender: TObject);
  923. var TheCCFMForm : TCCFileMgrForm;  { Holds duplicate while created }
  924. begin
  925.   { create the duplicate as child of Application }
  926.   TheCCFMForm := TCCFileMgrForm.Create( Application );
  927.   { Make it visible }
  928.   TheCCFMForm.Show;
  929. end;
  930.  
  931. procedure TCCFileMgrForm.FormDestroy(Sender: TObject);
  932. begin
  933.   { Release the IO Manager }
  934.   if assigned( TheIOManager) then
  935.   begin
  936.     TheIOManager.Free;
  937.     TheIOManager := nil;
  938.   end;
  939.   if Assigned( TheMouseManager ) then
  940.   begin
  941.     TheMouseManager.Free;
  942.     TheMouseManager := nil;
  943.   end;
  944.   if Assigned( Clock1 ) then
  945.   begin
  946.     Clock1.Free;
  947.     Clock2.Free;
  948.     Clock3.Free;
  949.     Clock1 := nil;
  950.     Clock2 := nil;
  951.     Clock3 := nil;
  952.   end;
  953. end;
  954.  
  955. procedure TCCFileMgrForm.FormKeyDown(Sender: TObject; var Key: Word;
  956.   Shift: TShiftState);
  957. var S_lock , N_Lock , C_lock : Boolean;
  958. begin
  959.   case Key of
  960.     VK_Capital : begin
  961.                    TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  962.                    C_Lock := not C_Lock;
  963.                    TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  964.                    Label2.Visible := C_Lock;
  965.                  end;
  966.     VK_End : begin
  967.                 ScrollBox1.VertScrollbar.Position :=
  968.                  ScrollBox1.VertScrollbar.Range;
  969.                 ScrollBox1.HorzScrollbar.Position :=
  970.                  ScrollBox1.HorzScrollBar.Range;
  971.              end;
  972.     VK_Home : begin
  973.                 ScrollBox1.VertScrollbar.Position := 0;
  974.                 ScrollBox1.HorzScrollbar.Position := 0;
  975.               end;
  976.     VK_Left : begin
  977.                 TheMouseManager.InitializeNormal;
  978.                 TheIOManager.WhichState := Shift;
  979.                 if TheIOManager.WasSHIFTPressed then
  980.                  TheMouseManager.MoveSmallJumpLeft else
  981.                   if TheIOManager.WasCTRLPressed then
  982.                    TheMouseManager.MoveLargeJumpLeft else
  983.                     TheMouseManager.MoveSinglePixelLeft;
  984.               end;
  985.     VK_Up : begin
  986.                 TheMouseManager.InitializeNormal;
  987.                 TheIOManager.WhichState := Shift;
  988.                 if TheIOManager.WasSHIFTPressed then
  989.                  TheMouseManager.MoveSmallJumpUP else
  990.                   if TheIOManager.WasCTRLPressed then
  991.                    TheMouseManager.MoveLargeJumpUp else
  992.                     TheMouseManager.MoveSinglePixelUp;
  993.               end;
  994.     VK_Right : begin
  995.                 TheMouseManager.InitializeNormal;
  996.                 TheIOManager.WhichState := Shift;
  997.                 if TheIOManager.WasSHIFTPressed then
  998.                  TheMouseManager.MoveSmallJumpRight else
  999.                   if TheIOManager.WasCTRLPressed then
  1000.                    TheMouseManager.MoveLargeJumpRight else
  1001.                     TheMouseManager.MoveSinglePixelRight;
  1002.               end;
  1003.     VK_Down : begin
  1004.                 TheMouseManager.InitializeNormal;
  1005.                 TheIOManager.WhichState := Shift;
  1006.                 if TheIOManager.WasSHIFTPressed then
  1007.                  TheMouseManager.MoveSmallJumpDown else
  1008.                   if TheIOManager.WasCTRLPressed then
  1009.                    TheMouseManager.MoveLargeJumpDown else
  1010.                     TheMouseManager.MoveSinglePixelDown;
  1011.               end;
  1012.     VK_F1 : TheIOManager.OnF1Pressed( Sender , Key , Shift );
  1013.     VK_F2 : TheIOManager.OnF2Pressed( Sender , Key , Shift );
  1014.     VK_F3 : TheIOManager.OnF3Pressed( Sender , Key , Shift );
  1015.     VK_F4 : TheIOManager.OnF4Pressed( Sender , Key , Shift );
  1016.     VK_F5 : TheIOManager.OnF5Pressed( Sender , Key , Shift );
  1017.     VK_F6 : TheIOManager.OnF6Pressed( Sender , Key , Shift );
  1018.     VK_F7 : TheIOManager.OnF7Pressed( Sender , Key , Shift );
  1019.     VK_F8 : TheIOManager.OnF8Pressed( Sender , Key , Shift );
  1020.     VK_F9 : TheIOManager.OnF9Pressed( Sender , Key , Shift );
  1021.     VK_F10 : TheIOManager.OnF10Pressed( Sender , Key , Shift );
  1022.     VK_F11 : TheIOManager.OnF11Pressed( Sender , Key , Shift );
  1023.     VK_F12 : TheIOManager.OnF12Pressed( Sender , Key , Shift );
  1024.     VK_Numlock : Begin
  1025.                    TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1026.                    N_Lock := not N_Lock;
  1027.                    TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1028.                    Label3.Visible := N_Lock;
  1029.                  end;
  1030.     VK_Scroll : Begin
  1031.                    TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1032.                    S_Lock := not S_Lock;
  1033.                    TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1034.                    Label4.Visible := S_Lock;
  1035.                 end;
  1036.   end;
  1037. end;
  1038.  
  1039. procedure TCCFileMgrForm.BitBtn9KeyDown(Sender: TObject; var Key: Word;
  1040.   Shift: TShiftState);
  1041. begin
  1042.   case Key of
  1043.     VK_CANCEL : begin
  1044.                   if MessageDlg( 'Control Break Pressed! Abort Search?',
  1045.                    mtConfirmation,mbYesNoCancel,0) = mrYes
  1046.                     then GlobalAbortFlag := true;
  1047.                 end;
  1048.   end;
  1049. end;
  1050.  
  1051. procedure TCCFileMgrForm.Label2Click(Sender: TObject);
  1052. var C_Lock , N_Lock , S_Lock : Boolean;
  1053. begin
  1054.   TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1055.   C_Lock := not C_Lock;
  1056.   TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1057.   Label2.Visible := C_Lock;
  1058. end;
  1059.  
  1060. procedure TCCFileMgrForm.Label3Click(Sender: TObject);
  1061. var C_Lock , N_Lock , S_Lock : Boolean;
  1062. begin
  1063.   TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1064.   N_Lock := not N_Lock;
  1065.   TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1066.   Label3.Visible := N_Lock;
  1067. end;
  1068.  
  1069. procedure TCCFileMgrForm.Label4Click(Sender: TObject);
  1070. var C_Lock , N_Lock , S_Lock : Boolean;
  1071. begin
  1072.   TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1073.   S_Lock := not S_Lock;
  1074.   TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1075.   Label4.Visible := S_Lock;
  1076. end;
  1077.  
  1078. procedure TCCFileMgrForm.Panel2MouseMove(Sender: TObject;
  1079.   Shift: TShiftState; X, Y: Integer);
  1080. var ThePoint, TheOtherPoint : TPoint;
  1081. begin
  1082.   if IconDragging then
  1083.   begin
  1084.     ThePoint.X := X + Panel2.Left;
  1085.     ThePoint.Y := Y + Panel2.Top;
  1086.     TheOtherPoint := ClientToScreen( ThePoint );
  1087.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1088.     exit;
  1089.   end;
  1090.   if BitmapDragging then
  1091.   begin
  1092.     ThePoint.X := X + Panel2.Left;
  1093.     ThePoint.Y := Y + Panel2.Top;
  1094.     TheOtherPoint := ClientToScreen( ThePoint );
  1095.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1096.     exit;
  1097.   end;
  1098. end;
  1099.  
  1100. procedure TCCFileMgrForm.Panel1MouseMove(Sender: TObject;
  1101.   Shift: TShiftState; X, Y: Integer);
  1102. var ThePoint, TheOtherPoint : TPoint;
  1103. begin
  1104.   if IconDragging then
  1105.   begin
  1106.     ThePoint.X := X + Panel1.Left;
  1107.     ThePoint.Y := Y + Panel1.Top;
  1108.     TheOtherPoint := ClientToScreen( ThePoint );
  1109.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1110.     exit;
  1111.   end;
  1112.   if BitmapDragging then
  1113.   begin
  1114.     ThePoint.X := X + Panel1.Left;
  1115.     ThePoint.Y := Y + Panel1.Top;
  1116.     TheOtherPoint := ClientToScreen( ThePoint );
  1117.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1118.     exit;
  1119.   end;
  1120. end;
  1121.  
  1122. procedure TCCFileMgrForm.Panel4MouseMove(Sender: TObject;
  1123.   Shift: TShiftState; X, Y: Integer);
  1124. var ThePoint, TheOtherPoint : TPoint;
  1125. begin
  1126.   if IconDragging then
  1127.   begin
  1128.     ThePoint.X := X + Panel4.Left;
  1129.     ThePoint.Y := Y + Panel4.Top;
  1130.     TheOtherPoint := ClientToScreen( ThePoint );
  1131.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1132.     exit;
  1133.   end;
  1134.   if BitmapDragging then
  1135.   begin
  1136.     ThePoint.X := X + Panel4.Left;
  1137.     ThePoint.Y := Y + Panel4.Top;
  1138.     TheOtherPoint := ClientToScreen( ThePoint );
  1139.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1140.     exit;
  1141.   end;
  1142. end;
  1143.  
  1144. procedure TCCFileMgrForm.Panel3MouseMove(Sender: TObject;
  1145.   Shift: TShiftState; X, Y: Integer);
  1146. var ThePoint, TheOtherPoint : TPoint;
  1147. begin
  1148.   if IconDragging then
  1149.   begin
  1150.     ThePoint.X := X + Panel3.Left;
  1151.     ThePoint.Y := Y + Panel3.Top;
  1152.     TheOtherPoint := ClientToScreen( ThePoint );
  1153.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1154.     exit;
  1155.   end;
  1156.   if BitmapDragging then
  1157.   begin
  1158.     ThePoint.X := X + Panel3.Left;
  1159.     ThePoint.Y := Y + Panel3.Top;
  1160.     TheOtherPoint := ClientToScreen( ThePoint );
  1161.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1162.     exit;
  1163.   end;
  1164. end;
  1165.  
  1166. procedure TCCFileMgrForm.BitBtn1MouseMove(Sender: TObject;
  1167.   Shift: TShiftState; X, Y: Integer);
  1168. var ThePoint, TheOtherPoint : TPoint;
  1169. begin
  1170.   if IconDragging then
  1171.   begin
  1172.     ThePoint.X := X + Panel2.Left + BitBtn1.Left;
  1173.     ThePoint.Y := Y + Panel2.Top + BitBtn1.Top;
  1174.     TheOtherPoint := ClientToScreen( ThePoint );
  1175.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1176.     exit;
  1177.   end;
  1178.   if BitmapDragging then
  1179.   begin
  1180.     ThePoint.X := X + Panel2.Left + BitBtn1.Left;
  1181.     ThePoint.Y := Y + Panel2.Top + BitBtn1.Top;
  1182.     TheOtherPoint := ClientToScreen( ThePoint );
  1183.     TheMouseManager.MovebitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1184.     exit;
  1185.   end;
  1186. end;
  1187.  
  1188. procedure TCCFileMgrForm.BitBtn2MouseMove(Sender: TObject;
  1189.   Shift: TShiftState; X, Y: Integer);
  1190. var ThePoint, TheOtherPoint : TPoint;
  1191. begin
  1192.   if IconDragging then
  1193.   begin
  1194.     ThePoint.X := X + Panel2.Left + BitBtn2.Left;
  1195.     ThePoint.Y := Y + Panel2.Top + BitBtn2.Top;
  1196.     TheOtherPoint := ClientToScreen( ThePoint );
  1197.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1198.     exit;
  1199.   end;
  1200.   if BitmapDragging then
  1201.   begin
  1202.     ThePoint.X := X + Panel2.Left + BitBtn2.Left;
  1203.     ThePoint.Y := Y + Panel2.Top + BitBtn2.Top;
  1204.     TheOtherPoint := ClientToScreen( ThePoint );
  1205.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1206.     exit;
  1207.   end;
  1208. end;
  1209.  
  1210. procedure TCCFileMgrForm.BitBtn3MouseMove(Sender: TObject;
  1211.   Shift: TShiftState; X, Y: Integer);
  1212. var ThePoint, TheOtherPoint : TPoint;
  1213. begin
  1214.   if IconDragging then
  1215.   begin
  1216.     ThePoint.X := X + Panel2.Left + BitBtn3.Left;
  1217.     ThePoint.Y := Y + Panel2.Top + BitBtn3.Top;
  1218.     TheOtherPoint := ClientToScreen( ThePoint );
  1219.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1220.     exit;
  1221.   end;
  1222.   if BitmapDragging then
  1223.   begin
  1224.     ThePoint.X := X + Panel2.Left + BitBtn3.Left;
  1225.     ThePoint.Y := Y + Panel2.Top + BitBtn3.Top;
  1226.     TheOtherPoint := ClientToScreen( ThePoint );
  1227.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1228.     exit;
  1229.   end;
  1230. end;
  1231.  
  1232. procedure TCCFileMgrForm.BitBtn4MouseMove(Sender: TObject;
  1233.   Shift: TShiftState; X, Y: Integer);
  1234. var ThePoint, TheOtherPoint : TPoint;
  1235. begin
  1236.   if IconDragging then
  1237.   begin
  1238.     ThePoint.X := X + Panel2.Left + BitBtn4.Left;
  1239.     ThePoint.Y := Y + Panel2.Top + BitBtn4.Top;
  1240.     TheOtherPoint := ClientToScreen( ThePoint );
  1241.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1242.     exit;
  1243.   end;
  1244.   if BitmapDragging then
  1245.   begin
  1246.     ThePoint.X := X + Panel2.Left + BitBtn4.Left;
  1247.     ThePoint.Y := Y + Panel2.Top + BitBtn4.Top;
  1248.     TheOtherPoint := ClientToScreen( ThePoint );
  1249.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1250.     exit;
  1251.   end;
  1252. end;
  1253.  
  1254. procedure TCCFileMgrForm.BitBtn5MouseMove(Sender: TObject;
  1255.   Shift: TShiftState; X, Y: Integer);
  1256. var ThePoint, TheOtherPoint : TPoint;
  1257. begin
  1258.   if IconDragging then
  1259.   begin
  1260.     ThePoint.X := X + Panel2.Left + BitBtn5.Left;
  1261.     ThePoint.Y := Y + Panel2.Top + BitBtn5.Top;
  1262.     TheOtherPoint := ClientToScreen( ThePoint );
  1263.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1264.     exit;
  1265.   end;
  1266.   if BitmapDragging then
  1267.   begin
  1268.     ThePoint.X := X + Panel2.Left + BitBtn5.Left;
  1269.     ThePoint.Y := Y + Panel2.Top + BitBtn5.Top;
  1270.     TheOtherPoint := ClientToScreen( ThePoint );
  1271.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1272.     exit;
  1273.   end;
  1274. end;
  1275.  
  1276. procedure TCCFileMgrForm.BitBtn8MouseMove(Sender: TObject;
  1277.   Shift: TShiftState; X, Y: Integer);
  1278. var ThePoint, TheOtherPoint : TPoint;
  1279. begin
  1280.   if IconDragging then
  1281.   begin
  1282.     ThePoint.X := X + Panel2.Left + BitBtn8.Left;
  1283.     ThePoint.Y := Y + Panel2.Top + BitBtn8.Top;
  1284.     TheOtherPoint := ClientToScreen( ThePoint );
  1285.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1286.     exit;
  1287.   end;
  1288.   if BitmapDragging then
  1289.   begin
  1290.     ThePoint.X := X + Panel2.Left + BitBtn8.Left;
  1291.     ThePoint.Y := Y + Panel2.Top + BitBtn8.Top;
  1292.     TheOtherPoint := ClientToScreen( ThePoint );
  1293.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1294.     exit;
  1295.   end;
  1296. end;
  1297.  
  1298. procedure TCCFileMgrForm.BitBtn9MouseMove(Sender: TObject;
  1299.   Shift: TShiftState; X, Y: Integer);
  1300. var ThePoint, TheOtherPoint : TPoint;
  1301. begin
  1302.   if IconDragging then
  1303.   begin
  1304.     ThePoint.X := X + Panel2.Left + BitBtn9.Left;
  1305.     ThePoint.Y := Y + Panel2.Top + BitBtn9.Top;
  1306.     TheOtherPoint := ClientToScreen( ThePoint );
  1307.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1308.     exit;
  1309.   end;
  1310.   if BitmapDragging then
  1311.   begin
  1312.     ThePoint.X := X + Panel2.Left + BitBtn9.Left;
  1313.     ThePoint.Y := Y + Panel2.Top + BitBtn9.Top;
  1314.     TheOtherPoint := ClientToScreen( ThePoint );
  1315.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1316.     exit;
  1317.   end;
  1318. end;
  1319.  
  1320. procedure TCCFileMgrForm.BitBtn6MouseMove(Sender: TObject;
  1321.   Shift: TShiftState; X, Y: Integer);
  1322. var ThePoint, TheOtherPoint : TPoint;
  1323. begin
  1324.   if IconDragging then
  1325.   begin
  1326.     ThePoint.X := X + Panel2.Left + BitBtn6.Left;
  1327.     ThePoint.Y := Y + Panel2.Top + BitBtn6.Top;
  1328.     TheOtherPoint := ClientToScreen( ThePoint );
  1329.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1330.     exit;
  1331.   end;
  1332.   if BitmapDragging then
  1333.   begin
  1334.     ThePoint.X := X + Panel2.Left + BitBtn6.Left;
  1335.     ThePoint.Y := Y + Panel2.Top + BitBtn6.Top;
  1336.     TheOtherPoint := ClientToScreen( ThePoint );
  1337.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1338.     exit;
  1339.   end;
  1340. end;
  1341.  
  1342. procedure TCCFileMgrForm.BitBtn7MouseMove(Sender: TObject;
  1343.   Shift: TShiftState; X, Y: Integer);
  1344. var ThePoint, TheOtherPoint : TPoint;
  1345. begin
  1346.   if IconDragging then
  1347.   begin
  1348.     ThePoint.X := X + Panel2.Left + BitBtn7.Left;
  1349.     ThePoint.Y := Y + Panel2.Top + BitBtn7.Top;
  1350.     TheOtherPoint := ClientToScreen( ThePoint );
  1351.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1352.     exit;
  1353.   end;
  1354.   if BitmapDragging then
  1355.   begin
  1356.     ThePoint.X := X + Panel2.Left + BitBtn7.Left;
  1357.     ThePoint.Y := Y + Panel2.Top + BitBtn7.Top;
  1358.     TheOtherPoint := ClientToScreen( ThePoint );
  1359.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1360.     exit;
  1361.   end;
  1362. end;
  1363.  
  1364. procedure TCCFileMgrForm.BitBtn10MouseMove(Sender: TObject;
  1365.   Shift: TShiftState; X, Y: Integer);
  1366. var ThePoint, TheOtherPoint : TPoint;
  1367. begin
  1368.   if IconDragging then
  1369.   begin
  1370.     ThePoint.X := X + Panel2.Left + BitBtn10.Left;
  1371.     ThePoint.Y := Y + Panel2.Top + BitBtn10.Top;
  1372.     TheOtherPoint := ClientToScreen( ThePoint );
  1373.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1374.     exit;
  1375.   end;
  1376.   if BitmapDragging then
  1377.   begin
  1378.     ThePoint.X := X + Panel2.Left + BitBtn10.Left;
  1379.     ThePoint.Y := Y + Panel2.Top + BitBtn10.Top;
  1380.     TheOtherPoint := ClientToScreen( ThePoint );
  1381.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1382.     exit;
  1383.   end;
  1384. end;
  1385.  
  1386. procedure TCCFileMgrForm.Panel5MouseMove(Sender: TObject;
  1387.   Shift: TShiftState; X, Y: Integer);
  1388. var ThePoint, TheOtherPoint : TPoint;
  1389. begin
  1390.   if IconDragging then
  1391.   begin
  1392.     ThePoint.X := X + Panel4.Left + Panel5.Left;
  1393.     ThePoint.Y := Y + Panel4.Top + Panel5.Top;
  1394.     TheOtherPoint := ClientToScreen( ThePoint );
  1395.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1396.     exit;
  1397.   end;
  1398.   if BitmapDragging then
  1399.   begin
  1400.     ThePoint.X := X + Panel4.Left + Panel5.Left;
  1401.     ThePoint.Y := Y + Panel4.Top + Panel5.Top;
  1402.     TheOtherPoint := ClientToScreen( ThePoint );
  1403.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1404.     exit;
  1405.   end;
  1406. end;
  1407.  
  1408. procedure TCCFileMgrForm.Panel6MouseMove(Sender: TObject;
  1409.   Shift: TShiftState; X, Y: Integer);
  1410. var ThePoint, TheOtherPoint : TPoint;
  1411. begin
  1412.   if IconDragging then
  1413.   begin
  1414.     ThePoint.X := X + Panel4.Left + Panel6.Left;
  1415.     ThePoint.Y := Y + Panel4.Top + Panel6.Top;
  1416.     TheOtherPoint := ClientToScreen( ThePoint );
  1417.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1418.     exit;
  1419.   end;
  1420.   if BitmapDragging then
  1421.   begin
  1422.     ThePoint.X := X + Panel4.Left + Panel6.Left;
  1423.     ThePoint.Y := Y + Panel4.Top + Panel6.Top;
  1424.     TheOtherPoint := ClientToScreen( ThePoint );
  1425.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1426.     exit;
  1427.   end;
  1428. end;
  1429.  
  1430. procedure TCCFileMgrForm.Panel7MouseMove(Sender: TObject;
  1431.   Shift: TShiftState; X, Y: Integer);
  1432. var ThePoint, TheOtherPoint : TPoint;
  1433. begin
  1434.   if IconDragging then
  1435.   begin
  1436.     ThePoint.X := X + Panel4.Left + Panel7.Left;
  1437.     ThePoint.Y := Y + Panel4.Top + Panel7.Top;
  1438.     TheOtherPoint := ClientToScreen( ThePoint );
  1439.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1440.     exit;
  1441.   end;
  1442.   if BitmapDragging then
  1443.   begin
  1444.     ThePoint.X := X + Panel4.Left + Panel7.Left;
  1445.     ThePoint.Y := Y + Panel4.Top + Panel7.Top;
  1446.     TheOtherPoint := ClientToScreen( ThePoint );
  1447.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1448.     exit;
  1449.   end;
  1450. end;
  1451.  
  1452. procedure TCCFileMgrForm.Panel1MouseUp(Sender: TObject;
  1453.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1454. begin
  1455.   if ( IconDragging or BitmapDragging ) then
  1456.   begin
  1457.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1458.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1459.     IconDragging := false;
  1460.     BitmapDragging := false;
  1461.     Invalidate;
  1462.   end;
  1463. end;
  1464.  
  1465. procedure TCCFileMgrForm.BitBtn1MouseUp(Sender: TObject;
  1466.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1467. var CurrentName ,                 { Holds work name}
  1468.     WorkingDir ,
  1469.     TheOldString : String;        { Holds Dir      }
  1470.     TargetDir    : String;        { target of op   }
  1471.     TheResult    : Integer;       { Modal res hold }
  1472.     Counter_1    : Integer;
  1473. begin
  1474.   If ( IconDragging  or BitmapDragging )then
  1475.   begin
  1476.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1477.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1478.     IconDragging := false;
  1479.     BitmapDragging := false;
  1480.     with GlobalSource as TFileIconPanel do
  1481.     begin
  1482.       { Get current directory and save it for later }
  1483.       GetDir( 0 , TheOldString );
  1484.       { Display the Windows-based directory input form }
  1485.       TheResult := DestDDForm.ShowModal;
  1486.       { If not cancelled do the copy }
  1487.       if TheResult = mrOK then
  1488.       begin
  1489.         CurrentName := FTheName;
  1490.         { Get the target directory with \ OK }
  1491.         TargetDir := DestDDForm.GetTargetDirectory;
  1492.         { If a directory signal and do recursive operation }
  1493.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  1494.         begin
  1495.           if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  1496.            +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  1497.           begin
  1498.             ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  1499.              TargetDir );
  1500.           end;
  1501.         end
  1502.         else
  1503.         begin
  1504.           { Do the copy }
  1505.           Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  1506.         end;
  1507.         { Reset to the original directory }
  1508.         ChDir( TheOldString );
  1509.       end
  1510.       else Invalidate;
  1511.     end;
  1512.   end;
  1513. end;
  1514.  
  1515. procedure TCCFileMgrForm.BitBtn2MouseUp(Sender: TObject;
  1516.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1517. var CurrentName ,                 { Holds work name}
  1518.     WorkingDir ,
  1519.     TheOldString : String;        { Holds Dir      }
  1520.     TargetDir    : String;        { target of op   }
  1521.     TheResult       : Integer;    { Modal res hold }
  1522.     Counter_1   : Integer;
  1523. begin
  1524.   If ( IconDragging  or BitmapDragging )then
  1525.   begin
  1526.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1527.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1528.     IconDragging := false;
  1529.     BitmapDragging := false;
  1530.     with GlobalSource as TFileIconPanel do
  1531.     begin
  1532.       { Get current directory and save it for later }
  1533.       GetDir( 0 , TheOldString );
  1534.       { Display the Windows-based directory input form }
  1535.       TheResult := DestDDForm.ShowModal;
  1536.       { If not cancelled do the copy }
  1537.       if TheResult = mrOK then
  1538.       begin
  1539.         { Get the target directory with \ OK }
  1540.         TargetDir := DestDDForm.GetTargetDirectory;
  1541.         { If Copyfile returns false an error occurred }
  1542.         CurrentName := FTheName;
  1543.         { If a directory signal and do recursion }
  1544.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  1545.         begin
  1546.           if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
  1547.            '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
  1548.             ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  1549.              TargetDir );
  1550.         end
  1551.         else
  1552.         begin  { Do the move }
  1553.           Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  1554.           ChDir( TheOldString );
  1555.         end;
  1556.         { Refresh display }
  1557.         ScrollBox1.Update;
  1558.       end
  1559.       else Invalidate;
  1560.     end;
  1561.   end;
  1562. end;
  1563.  
  1564. procedure TCCFileMgrForm.BitBtn3MouseUp(Sender: TObject;
  1565.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1566. var WorkingDir ,
  1567.     CurrentName : String;  { Holds work name}
  1568.     Counter_1   : Integer;
  1569. begin
  1570.   If ( IconDragging  or BitmapDragging )then
  1571.   begin
  1572.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1573.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1574.     IconDragging := false;
  1575.     BitmapDragging := false;
  1576.     with GLobalSource as TFileIconPanel do
  1577.     begin
  1578.       CurrentName := FTheName;
  1579.       { If its a directory signal and do recursive delete }
  1580.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  1581.       begin
  1582.         if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation ,
  1583.          mbYesNoCancel , 0 ) = mrYes then
  1584.         begin
  1585.           Scrollbox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  1586.           Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
  1587.         end
  1588.         else Invalidate;
  1589.       end
  1590.       else
  1591.       begin
  1592.         { Otherwise get confirmation message and if OKed delete file }
  1593.         if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  1594.          mbYesNoCancel , 0 ) = mrYes then
  1595.         begin
  1596.           Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
  1597.         end
  1598.         else Invalidate;
  1599.       end;
  1600.       { Refresh Display }
  1601.       Scrollbox1.Update;
  1602.     end;
  1603.   end;
  1604. end;
  1605.  
  1606. procedure TCCFileMgrForm.BitBtn4MouseUp(Sender: TObject;
  1607.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1608. var WorkingDir ,
  1609.     CurrentName : String;  { Holds work name}
  1610.     Counter_1   : Integer;
  1611. begin
  1612.   If ( IconDragging  or BitmapDragging )then
  1613.   begin
  1614.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1615.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1616.     IconDragging := false;
  1617.     BitmapDragging := false;
  1618.     with GlobalSource as TFileIconPanel do
  1619.     begin
  1620.       CurrentName := FTheName;
  1621.       { If a directory signal error }
  1622.       { Otherwise set up the opendialog with filename and caption }
  1623.       OpenDialog2.Filename := ExtractFilename( CurrentName );
  1624.       { Use this to prevent error from changing directories }
  1625.       OpenDialog2.Options := [ofNoChangeDir];
  1626.       OpenDialog2.Title := 'Rename File';
  1627.       { If not cancelled then do rename or signal error }
  1628.       if OpenDialog2.Execute then
  1629.       begin
  1630.         Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog2.Filename );
  1631.       end
  1632.       else Invalidate;
  1633.       { Refresh the display }
  1634.       ScrollBox1.Update;
  1635.     end;
  1636.   end;
  1637. end;
  1638.  
  1639. end.
  1640.